﻿#region license
/**********************************************
* CopyRight (c) 2009-2010 HangJing Teconology. All Rights Re* Function :
* Created by jijunjian at 2011-6-22 16:34:17.
* E-Mail: jijunjian@ihangjing.com
*********************************************** */
#endregion
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

using Hangjing.SQLServerDAL;
using Hangjing.Common;
using Hangjing.Model;
using Hangjing.DBUtility;
using System.Text.RegularExpressions;
using Hangjing.Cache;
using System.Threading;
using System.Data;
using Hangjing.Config;
using Newtonsoft.Json;
using System.Collections;
using System.IO;

using MVCNPOIHelper.Common;
using Hangjing.EleAPI;
using System.Threading.Tasks;
using Hangjing.WebCommon;

public partial class test : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        

        if (!Page.IsPostBack)
        {
            new OrderServiceImpl().manComplete("e181016000025", 78);

            Response.Write(DateTime.Now.ToShortTimeString());

            return;




            for (int i = 0; i < 100; i++)
            {
                Thread.Sleep(300);
                Task.Run(() => {


                    pringIndex(i);


                });
            }


            //baseEleAPI api = new baseEleAPI();
            //api.init(Context);

            //api.queryPullNewOrder();

            //Hangjing.WebCommon.SendMsg.SendOrderDeliver("18758580307", "8888", "丰州", "77777", 4);

            //new Points().GetSendFeeModel(1015);

            //new Hangjing.meituanapi.mthelper(Context).shopOnline(1015);

        }

    }

    public void pringIndex(int i)
    {
        Hangjing.AppLog.AppLog.Info(i);
    }

    protected void query_Click(object sender, EventArgs e)
    {
        string restaurant_id = Request.QueryString["tid"];
        string order_mode = Request.QueryString["state"];

        baseEleAPI api = new baseEleAPI();
        api.init(Context);

        api.setorder_mode(restaurant_id, order_mode);

    }

    protected void pull_Click(object sender, EventArgs e)
    {
      
        baseEleAPI api = new baseEleAPI();
        api.init(Context);

       // api.queryPullNewOrder();

        //api.queryNewOrder_test();

    }
    protected void add_Click(object sender, EventArgs e)
    {

        baseEleAPI api = new baseEleAPI();
        api.init(Context);


        string msg = "{\"message\":\"ok\",\"code\":200,\"data\":{\"original_price\":131.0,\"restaurant_name\":\"阿文鱼头\",\"refund_code\":0,\"status_code\":9,\"restaurant_id\":2102077,\"service_fee\":0.0,\"consignee\":\"齐天大圣 女士\",\"invoice\":\"\",\"description\":\"6人用餐, 中辣 不要姜，多点葱\",\"user_id\":124762573,\"delivery_geo\":\"24.47757,118.12206\",\"detail\":{\"abandoned_extra\":[],\"group\":[[{\"sku_id\":\"61315998447\",\"name\":\"泡椒田鸡 - 泡椒田鸡（大份，1500G）\",\"price\":118.0,\"sale_mode\":0,\"new_specs\":[{\"name\":\"规格\",\"value\":\"泡椒田鸡（大份，1500G）\"}],\"id\":184479007,\"attrs\":[],\"garnish\":[],\"category_id\":1,\"specs\":[\"泡椒田鸡（大份，1500G）\"],\"quantity\":1}]],\"extra\":[{\"description\":\"\",\"price\":3.0,\"name\":\"餐盒\",\"category_id\":102,\"id\":-70000,\"quantity\":1},{\"description\":\"\",\"quantity\":1,\"price\":-1.0,\"id\":21242029,\"category_id\":12,\"type\":102,\"stats_quantity\":1,\"name\":\"(不与美食活动同享)在线支付立减优惠\"},{\"description\":\"\",\"price\":10.0,\"name\":\"配送费\",\"category_id\":2,\"id\":-10,\"quantity\":1},{\"description\":\"\",\"price\":-4.7,\"name\":\"红包抵扣\",\"category_id\":13,\"type\":0,\"id\":5641334974385,\"quantity\":1}]},\"active_at\":\"2017 - 03 - 02 22:47:50\",\"invoiced\":0,\"user_name\":\"Kim裘裘\",\"deliver_fee\":10.0,\"is_book\":0,\"restaurant_part\":0.5,\"deliver_time\":null,\"order_id\":\"1202703598425452731\",\"eleme_part\":0.5,\"income\":130.5,\"restaurant_number\":2,\"address\":\"明发商业广场中区333号（堂口酒吧）舒康汗蒸隔壁\",\"hongbao\":-4.7,\"is_online_paid\":1,\"delivery_poi_address\":\"明发商业广场中区333号（堂口酒吧）舒康汗蒸隔壁(福建省厦门市思明区嘉禾路78号明发商业广场B1楼镜尚眼镜批发市场G89号(近莲坂BRTB1楼))\",\"total_price\":125.3,\"created_at\":\"2017 - 03 - 02 22:47:48\",\"service_rate\":0.0,\"package_fee\":3.0,\"activity_total\":1.0,\"phone_list\":[\"18759562177\"]},\"request_id\":\"e6666a4df50f4bf4b34a98c091049df0\"}";


        eleOrder orderinfo = JsonConvert.DeserializeObject<eleOrder>(msg);
        if (orderinfo.data != null)
        {
            api.AddOrder(orderinfo);


        }

    }

    



    public class UserInfo
    {
        public string Id { get; set; }
        public string Name { get; set; }
        public int Age { get; set; }
        public DateTime BirDate { get; set; }
    }
}
